<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.sbl.bajw.pc.model.CameraModel"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@include file="../../common/prama.jsp" %>
    <%
    List<HashMap<String,Object>> CameraClassDict = (List<HashMap<String,Object>>)request.getAttribute("CameraClassDict");
    List<HashMap<String,Object>> CameraDirectionDict = (List<HashMap<String,Object>>)request.getAttribute("CameraDirectionDict");
    List<HashMap<String,Object>> CameraPlaceDict = (List<HashMap<String,Object>>)request.getAttribute("CameraPlaceDict");
    List<HashMap<String,Object>> CameraTimeDict = (List<HashMap<String,Object>>)request.getAttribute("CameraTimeDict");
    List<HashMap<String,Object>> CameraTypeDict = (List<HashMap<String,Object>>)request.getAttribute("CameraTypeDict");
    List<HashMap<String,Object>> CameraYunyingshangDict = (List<HashMap<String,Object>>)request.getAttribute("CameraYunyingshangDict");
    List<HashMap<String,String>> pics = (List<HashMap<String,String>>)request.getAttribute("pics");
    CameraModel model = (CameraModel)request.getAttribute("model");
    String installDate = "";
    if(model.getInstallDate() != null){
    	SimpleDateFormat df = new SimpleDateFormat("yyyy-M-dd");
    	installDate = df.format(model.getInstallDate());
    }
    %>
<script type="text/javascript" src="${burl }/js/business/manager/CameraMain.js"></script>
<div class="CommonPanel" id="cameraForm">
	<div style="float:left;width:200px;height:200px;overflow: hidden;position: relative;">
		<div id="picContentDiv" style="width:<%=200*pics.size()%>px;position: absolute;left:0">
		<%
			for(int i = 0 ;i<pics.size();i++){
				String imgUrl = BaseUrl +"/"+ pics.get(i).get("SMALLIMGURL");
			%>
			<img width="200" style="float:left" src="<%=imgUrl%>"/>
			
			<%
			}
		%>
		</div>
		<div id="preBtn" style="position: absolute;left: 0;top: 50%;cursor: pointer;"><<</div>
		<div id="nextBtn" style="position: absolute;right: 0;top: 50%;cursor: pointer;">>></div>
	</div>
	<table style="float:left;">
		<tr>
			<td class="label">摄像头所有人或单位:</td>
			<td class="input">
				<input name="belongName" value="${model.belongName }"/>
			</td>
			<td class="label">联系电话:</td>
			<td class="input">
				<input name="belongPhone" value="${model.belongPhone }"/>
			</td>
		</tr>
		<tr>
			<td class="label">监控室地址:</td>
			<td class="input">
				<input name="houseAddress" value="${model.houseAddress }"/>
			</td>
			<td class="label">厂家:</td>
			<td class="input">
				<input name="factoryName" value="${model.factoryName }"/>
			</td>
		</tr>
		<tr>
			<td class="label">摄像头地址:</td>
			<td class="input">
				<input id="cameraAddress" name="cameraAddress" value="${model.cameraAddress }"/>
			</td>
			<td class="label">ATM编号:</td>
			<td class="input">
				<input name="atmCode" value="${model.atmCode }"/>
			</td>
		</tr>
		<tr>
			<td class="label">基站名称:</td>
			<td class="input">
				<input id="baseStationName" name="baseStationName" value="${model.baseStationName }"/>
			</td>
			<td class="label">基站代码:</td>
			<td class="input">
				<input name="baseStationCode" value="${model.baseStationCode }"/>
			</td>
		</tr>
		<tr>
			<td class="label">摄像头类型：</td>
			<td class="input">
				<select name="cameraClass">
					<option>--选择--</option>
					<%
						for(int i =0;i<CameraClassDict.size();i++){
							HashMap<String,Object> row = CameraClassDict.get(i);
							String id = row.get("ID")+"";
							String name = row.get("NAME")+"";
							String selected = id.equals(model.getCameraClass())?"selected":"";
						%>
						<option <%=selected %> value="<%=id%>"><%=name %></option>
						<%
						}
					%>
				</select>
			</td>
			<td class="label">摄像头方向：</td>
			<td class="input">
				<select name="cameraDirection">
					<option>--选择--</option>
					<%
						for(int i =0;i<CameraDirectionDict.size();i++){
							HashMap<String,Object> row = CameraDirectionDict.get(i);
							String id = row.get("ID")+"";
							String name = row.get("NAME")+"";
							String selected = id.equals(model.getCameraDirection())?"selected":"";
						%>
						<option <%=selected %> value="<%=id%>"><%=name %></option>
						<%
						}
					%>
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">摄像头场所：</td>
			<td class="input">
				<select name="cameraPlace">
					<option>--选择--</option>
					<%
						for(int i =0;i<CameraPlaceDict.size();i++){
							HashMap<String,Object> row = CameraPlaceDict.get(i);
							String id = row.get("ID")+"";
							String name = row.get("NAME")+"";
							String selected = id.equals(model.getCameraPlace())?"selected":"";
						%>
						<option <%=selected %> value="<%=id%>"><%=name %></option>
						<%
						}
					%>
				</select>
			</td>
			<td class="label">摄像头保存时间：</td>
			<td class="input">
				<select name="saveTime">
					<option>--选择--</option>
					<%
						for(int i =0;i<CameraTimeDict.size();i++){
							HashMap<String,Object> row = CameraTimeDict.get(i);
							String id = row.get("ID")+"";
							String name = row.get("NAME")+"";
							String selected = id.equals(model.getSaveTime())?"selected":"";
						%>
						<option <%=selected %> value="<%=id%>"><%=name %></option>
						<%
						}
					%>
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">摄像头类别：</td>
			<td class="input">
				<select name="cameraType">
					<option>--选择--</option>
					<%
						for(int i =0;i<CameraTypeDict.size();i++){
							HashMap<String,Object> row = CameraTypeDict.get(i);
							String id = row.get("ID")+"";
							String name = row.get("NAME")+"";
							String selected = id.equals(model.getCameraType())?"selected":"";
						%>
						<option <%=selected %> value="<%=id%>"><%=name %></option>
						<%
						}
					%>
				</select>
			</td>
			<td class="label">基站运营商：</td>
			<td class="input">
				<select name="baseStationBelong">
					<option>--选择--</option>
					<%
						for(int i =0;i<CameraYunyingshangDict.size();i++){
							HashMap<String,Object> row = CameraYunyingshangDict.get(i);
							String id = row.get("ID")+"";
							String name = row.get("NAME")+"";
							String selected = id.equals(model.getBaseStationBelong())?"selected":"";
						%>
						<option <%=selected %> value="<%=id%>"><%=name %></option>
						<%
						}
					%>
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">安装时间:</td>
			<td class="input">
				<input name="installDate" value="<%=installDate %>" /> 
			</td>
			<td class="label">环境:</td>
			<td class="input">
				<select name="indoorOutdoor">
					<option <%="0".equals(model.getIndoorOutdoor())?"selected":"" %> value="0">室外</option>
					<option <%="1".equals(model.getIndoorOutdoor())?"selected":"" %> value="1">室内</option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">是否正常:</td>
			<td class="input">
				<select name="isTrue">
					<option <%="0".equals(model.getIsTrue())?"selected":"" %> value="0">不正常</option>
					<option <%="1".equals(model.getIsTrue())?"selected":"" %> value="1">正常</option>
				</select>
			</td>
			<td class="label">楼栋编码:</td>
			<td class="input">
				<input name="buildingCode" value="<%=model.getBuildingCode() %>" /> 
			</td>
		</tr>
	</table>
	<input name="id" type="hidden" value="${model.id }"/>
	<input id="lat" name="lat" type="hidden" value="${model.lat }"/>
	<input id="lon" name="lon" type="hidden" value="${model.lon }"/>
	<input id=parentMenu type="hidden" value="/Camera/easyList.do"/>
	<div style="clear: both;margin-bottom: 4px"></div>
	<div id="bmap" style="height: 270px;width: 100%;"></div>
	<div style="text-align: center;">
		<button class="commonBtn" style="font-size: 20px" id="submitBtn">保存</button>
	</div>
</div>